// 全局通用的样式类
@import "variables";

// text\bg color
@each $colorKey, $color in $colors {
  .text-#{$colorKey} {
    color: $color
  }
  .bg-#{$colorKey} {
    background-color: $color;
  }
};
// text align
@each $var in (left, center, right) {
  .text-#{$var} {
    text-align: $var
  }
};

// font size
@each $sizeKey, $size in $font-size {
  .fs-#{$sizeKey} {
    font-size: $size * $base-font-size;
  }
}
// text ellipsis ...
.text-elps {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
};

// width\height 100%
.v-100 {
  height: 100%;
};
.w-100 {
  width: 100%;
};

// about flex
.d-flex {
  display: flex;
};
.flex-col {
  flex-direction: column;
};
.flex-wrap {
  flex-wrap: wrap;
};
.flex-grow-1 {
  flex-grow: 1;
};

@each $key, $val in $flex-jc {
  .jc-#{$key} {
    justify-content: $val;
  }
};
@each $key, $val in $flex-ai {
  .ai-#{$key} {
    align-items: $val;
  }
};

// usually padding/margin size

@each $typeKey, $type in $spaceing-type {
  //.m-3 --> margin: 1rem
  @each $sizeKey, $size in $spaceing-sizes {
    .#{$typeKey}-#{$sizeKey} {
      #{$typeKey}: $size * $spaceing-base-size;
    }
  }

  // mx-3 -->  margin: 0 1rem
  @each $sizeKey, $size in $spaceing-sizes {
    .#{$typeKey}x-#{$sizeKey} {
      #{$type}-left: $size * $spaceing-base-size;
      #{$type}-right: $size * $spaceing-base-size;
    }
  }

  // my-3 -->  margin: 1rem 0
  @each $sizeKey, $size in $spaceing-sizes {
    .#{$typeKey}y-#{$sizeKey} {
      #{$type}-top: $size * $spaceing-base-size;
      #{$type}-bottom: $size * $spaceing-base-size;
    }
  }

  // .pt-1 --> padding-top: 0.25rem
  @each $directKey, $direct in $spaceing-directions {
    @each $sizeKey, $size in $spaceing-sizes {
      .#{$typeKey}#{$directKey}-#{$sizeKey} {
        #{$type}-#{$direct}: $size * $spaceing-base-size;
      }
    }
  }
}

